package com.app.service;

import com.app.model.main.EmpiricalValueRecord;
import com.app.model.util.EmpiricalSource;
import com.app.repository.interfaces.EmpiricalValueRecordMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * Campus com.app.service
 *
 * @author Lichaojie
 * @version 2018/5/8 19:39
 */
@Service
public class EmpiricalService {

	@Autowired
	private EmpiricalValueRecordMapper empiricalValueRecordMapper;

	public void add(long userId,EmpiricalSource source){
		EmpiricalValueRecord record = new EmpiricalValueRecord();
		record = new EmpiricalValueRecord();
		record.setUserId(userId)
				.setEmpiricalValue(source.getValue())
				.setSource(source.getIndex())
				.setTime(Long.toString(System.currentTimeMillis()));
		empiricalValueRecordMapper.insert(record);
	}
}
